/**
 *
 */
import Util;
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-1 = 'viapi-regen-daily.aliyuncs.com',
    ap-northeast-2-pop = 'viapi-regen-daily.aliyuncs.com',
    ap-south-1 = 'viapi-regen-daily.aliyuncs.com',
    ap-southeast-1 = 'viapi-regen-daily.aliyuncs.com',
    ap-southeast-2 = 'viapi-regen-daily.aliyuncs.com',
    ap-southeast-3 = 'viapi-regen-daily.aliyuncs.com',
    ap-southeast-5 = 'viapi-regen-daily.aliyuncs.com',
    cn-beijing = 'viapi-regen-daily.aliyuncs.com',
    cn-beijing-finance-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-beijing-finance-pop = 'viapi-regen-daily.aliyuncs.com',
    cn-beijing-gov-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-beijing-nu16-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-chengdu = 'viapi-regen-daily.aliyuncs.com',
    cn-edge-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-fujian = 'viapi-regen-daily.aliyuncs.com',
    cn-haidian-cm12-c01 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-bj-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-finance = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-internal-prod-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-internal-test-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-internal-test-2 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-internal-test-3 = 'viapi-regen-daily.aliyuncs.com',
    cn-hangzhou-test-306 = 'viapi-regen-daily.aliyuncs.com',
    cn-hongkong = 'viapi-regen-daily.aliyuncs.com',
    cn-hongkong-finance-pop = 'viapi-regen-daily.aliyuncs.com',
    cn-huhehaote = 'viapi-regen-daily.aliyuncs.com',
    cn-huhehaote-nebula-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-north-2-gov-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-qingdao = 'viapi-regen-daily.aliyuncs.com',
    cn-qingdao-nebula = 'viapi-regen-daily.aliyuncs.com',
    cn-shanghai-et15-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-shanghai-et2-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-shanghai-finance-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-shanghai-inner = 'viapi-regen-daily.aliyuncs.com',
    cn-shanghai-internal-test-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-shenzhen = 'viapi-regen-daily.aliyuncs.com',
    cn-shenzhen-finance-1 = 'viapi-regen-daily.aliyuncs.com',
    cn-shenzhen-inner = 'viapi-regen-daily.aliyuncs.com',
    cn-shenzhen-st4-d01 = 'viapi-regen-daily.aliyuncs.com',
    cn-shenzhen-su18-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-wuhan = 'viapi-regen-daily.aliyuncs.com',
    cn-wulanchabu = 'viapi-regen-daily.aliyuncs.com',
    cn-yushanfang = 'viapi-regen-daily.aliyuncs.com',
    cn-zhangbei = 'viapi-regen-daily.aliyuncs.com',
    cn-zhangbei-na61-b01 = 'viapi-regen-daily.aliyuncs.com',
    cn-zhangjiakou = 'viapi-regen-daily.aliyuncs.com',
    cn-zhangjiakou-na62-a01 = 'viapi-regen-daily.aliyuncs.com',
    cn-zhengzhou-nebula-1 = 'viapi-regen-daily.aliyuncs.com',
    eu-central-1 = 'viapi-regen-daily.aliyuncs.com',
    eu-west-1 = 'viapi-regen-daily.aliyuncs.com',
    eu-west-1-oxs = 'viapi-regen-daily.aliyuncs.com',
    me-east-1 = 'viapi-regen-daily.aliyuncs.com',
    rus-west-1-pop = 'viapi-regen-daily.aliyuncs.com',
    us-east-1 = 'viapi-regen-daily.aliyuncs.com',
    us-west-1 = 'viapi-regen-daily.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('viapi-regen', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CheckDatasetOssBucketCORSRequest {
  labelsetId?: long(name='LabelsetId'),
}

model CheckDatasetOssBucketCORSResponseBody = {
  data?: {
    bucket?: string(name='Bucket'),
    ossBucketCORSConfigUrl?: string(name='OssBucketCORSConfigUrl'),
    setOssBucketCORSFlag?: boolean(name='SetOssBucketCORSFlag'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CheckDatasetOssBucketCORSResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckDatasetOssBucketCORSResponseBody(name='body'),
}

async function checkDatasetOssBucketCORSWithOptions(request: CheckDatasetOssBucketCORSRequest, runtime: Util.RuntimeOptions): CheckDatasetOssBucketCORSResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.labelsetId)) {
    body['LabelsetId'] = request.labelsetId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckDatasetOssBucketCORS',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkDatasetOssBucketCORS(request: CheckDatasetOssBucketCORSRequest): CheckDatasetOssBucketCORSResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDatasetOssBucketCORSWithOptions(request, runtime);
}

model CreateDatasetRequest {
  description?: string(name='Description'),
  name?: string(name='Name'),
  type?: string(name='Type'),
  workspaceId?: long(name='WorkspaceId'),
}

model CreateDatasetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDatasetResponseBody(name='body'),
}

async function createDatasetWithOptions(request: CreateDatasetRequest, runtime: Util.RuntimeOptions): CreateDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDataset(request: CreateDatasetRequest): CreateDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDatasetWithOptions(request, runtime);
}

model CreateLabelsetRequest {
  datasetId?: long(name='DatasetId'),
  description?: string(name='Description'),
  name?: string(name='Name'),
  objectKey?: string(name='ObjectKey'),
  preLabelId?: long(name='PreLabelId'),
  tagSettings?: string(name='TagSettings'),
  tagUserList?: string(name='TagUserList'),
  type?: string(name='Type'),
  userOssUrl?: string(name='UserOssUrl'),
}

model CreateLabelsetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelType?: string(name='LabelType'),
    name?: string(name='Name'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateLabelsetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateLabelsetResponseBody(name='body'),
}

async function createLabelsetWithOptions(request: CreateLabelsetRequest, runtime: Util.RuntimeOptions): CreateLabelsetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.objectKey)) {
    body['ObjectKey'] = request.objectKey;
  }
  if (!Util.isUnset(request.preLabelId)) {
    body['PreLabelId'] = request.preLabelId;
  }
  if (!Util.isUnset(request.tagSettings)) {
    body['TagSettings'] = request.tagSettings;
  }
  if (!Util.isUnset(request.tagUserList)) {
    body['TagUserList'] = request.tagUserList;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  if (!Util.isUnset(request.userOssUrl)) {
    body['UserOssUrl'] = request.userOssUrl;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateLabelset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createLabelset(request: CreateLabelsetRequest): CreateLabelsetResponse {
  var runtime = new Util.RuntimeOptions{};
  return createLabelsetWithOptions(request, runtime);
}

model CreateServiceRequest {
  authorizationType?: string(name='AuthorizationType'),
  authorizedAccount?: string(name='AuthorizedAccount'),
  description?: string(name='Description'),
  name?: string(name='Name'),
  trainTaskId?: long(name='TrainTaskId'),
}

model CreateServiceResponseBody = {
  data?: {
    authorizationType?: string(name='AuthorizationType'),
    authorizedAccount?: string(name='AuthorizedAccount'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    serviceDescription?: string(name='ServiceDescription'),
    serviceName?: string(name='ServiceName'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateServiceResponseBody(name='body'),
}

async function createServiceWithOptions(request: CreateServiceRequest, runtime: Util.RuntimeOptions): CreateServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorizationType)) {
    body['AuthorizationType'] = request.authorizationType;
  }
  if (!Util.isUnset(request.authorizedAccount)) {
    body['AuthorizedAccount'] = request.authorizedAccount;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.trainTaskId)) {
    body['TrainTaskId'] = request.trainTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createService(request: CreateServiceRequest): CreateServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createServiceWithOptions(request, runtime);
}

model CreateTagTaskRequest {
  labelsetId?: long(name='LabelsetId'),
}

model CreateTagTaskResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelType?: string(name='LabelType'),
    name?: string(name='Name'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateTagTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTagTaskResponseBody(name='body'),
}

async function createTagTaskWithOptions(request: CreateTagTaskRequest, runtime: Util.RuntimeOptions): CreateTagTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.labelsetId)) {
    body['LabelsetId'] = request.labelsetId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTagTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTagTask(request: CreateTagTaskRequest): CreateTagTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTagTaskWithOptions(request, runtime);
}

model CreateTrainTaskRequest {
  advancedParameters?: string(name='AdvancedParameters'),
  datasetIds?: string(name='DatasetIds'),
  description?: string(name='Description'),
  labelIds?: string(name='LabelIds'),
  name?: string(name='Name'),
  preTrainTaskId?: long(name='PreTrainTaskId'),
  trainMode?: string(name='TrainMode'),
  workspaceId?: long(name='WorkspaceId'),
}

model CreateTrainTaskResponseBody = {
  data?: {
    advancedParameters?: string(name='AdvancedParameters'),
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    relyOnTaskId?: long(name='RelyOnTaskId'),
    relyOnTaskName?: string(name='RelyOnTaskName'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTrainTaskResponseBody(name='body'),
}

async function createTrainTaskWithOptions(request: CreateTrainTaskRequest, runtime: Util.RuntimeOptions): CreateTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.advancedParameters)) {
    body['AdvancedParameters'] = request.advancedParameters;
  }
  if (!Util.isUnset(request.datasetIds)) {
    body['DatasetIds'] = request.datasetIds;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.labelIds)) {
    body['LabelIds'] = request.labelIds;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.preTrainTaskId)) {
    body['PreTrainTaskId'] = request.preTrainTaskId;
  }
  if (!Util.isUnset(request.trainMode)) {
    body['TrainMode'] = request.trainMode;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTrainTask(request: CreateTrainTaskRequest): CreateTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTrainTaskWithOptions(request, runtime);
}

model CreateWorkspaceRequest {
  description?: string(name='Description'),
  name?: string(name='Name'),
  type?: string(name='Type'),
}

model CreateWorkspaceResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    type?: string(name='Type'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CreateWorkspaceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateWorkspaceResponseBody(name='body'),
}

async function createWorkspaceWithOptions(request: CreateWorkspaceRequest, runtime: Util.RuntimeOptions): CreateWorkspaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateWorkspace',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createWorkspace(request: CreateWorkspaceRequest): CreateWorkspaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createWorkspaceWithOptions(request, runtime);
}

model CustomizeClassifyImageRequest {
  imageUrl?: string(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeClassifyImageAdvanceRequest {
  imageUrlObject?: readable(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeClassifyImageResponseBody = {
  data?: {
    category?: string(name='Category'),
    score?: float(name='Score'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CustomizeClassifyImageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CustomizeClassifyImageResponseBody(name='body'),
}

async function customizeClassifyImageWithOptions(request: CustomizeClassifyImageRequest, runtime: Util.RuntimeOptions): CustomizeClassifyImageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.imageUrl)) {
    body['ImageUrl'] = request.imageUrl;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CustomizeClassifyImage',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function customizeClassifyImage(request: CustomizeClassifyImageRequest): CustomizeClassifyImageResponse {
  var runtime = new Util.RuntimeOptions{};
  return customizeClassifyImageWithOptions(request, runtime);
}

async function customizeClassifyImageAdvance(request: CustomizeClassifyImageAdvanceRequest, runtime: Util.RuntimeOptions): CustomizeClassifyImageResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.isUnset(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'viapi-regen',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = null;

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var customizeClassifyImageReq = new CustomizeClassifyImageRequest{};
  OpenApiUtil.convert(request, customizeClassifyImageReq);

  if(!Util.isUnset(request.imageUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.imageUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    customizeClassifyImageReq.imageUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var customizeClassifyImageResp = customizeClassifyImageWithOptions(customizeClassifyImageReq, runtime);
  return customizeClassifyImageResp;
}

model CustomizeDetectImageRequest {
  imageUrl?: string(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeDetectImageAdvanceRequest {
  imageUrlObject?: readable(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeDetectImageResponseBody = {
  data?: {
    elements?: [ 
      {
        boxes?: {
          height?: float(name='Height'),
          width?: float(name='Width'),
          x?: float(name='X'),
          y?: float(name='Y'),
        }(name='Boxes'),
        category?: string(name='Category'),
        score?: float(name='Score'),
      }
    ](name='Elements'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CustomizeDetectImageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CustomizeDetectImageResponseBody(name='body'),
}

async function customizeDetectImageWithOptions(request: CustomizeDetectImageRequest, runtime: Util.RuntimeOptions): CustomizeDetectImageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.imageUrl)) {
    body['ImageUrl'] = request.imageUrl;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CustomizeDetectImage',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function customizeDetectImage(request: CustomizeDetectImageRequest): CustomizeDetectImageResponse {
  var runtime = new Util.RuntimeOptions{};
  return customizeDetectImageWithOptions(request, runtime);
}

async function customizeDetectImageAdvance(request: CustomizeDetectImageAdvanceRequest, runtime: Util.RuntimeOptions): CustomizeDetectImageResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.isUnset(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'viapi-regen',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = null;

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var customizeDetectImageReq = new CustomizeDetectImageRequest{};
  OpenApiUtil.convert(request, customizeDetectImageReq);

  if(!Util.isUnset(request.imageUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.imageUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    customizeDetectImageReq.imageUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var customizeDetectImageResp = customizeDetectImageWithOptions(customizeDetectImageReq, runtime);
  return customizeDetectImageResp;
}

model CustomizeInstanceSegmentImageRequest {
  imageUrl?: string(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeInstanceSegmentImageAdvanceRequest {
  imageUrlObject?: readable(name='ImageUrl'),
  serviceId?: string(name='ServiceId'),
}

model CustomizeInstanceSegmentImageResponseBody = {
  data?: {
    elements?: [ 
      {
        boxes?: {
          height?: int32(name='Height'),
          width?: int32(name='Width'),
          x?: int32(name='X'),
          y?: int32(name='Y'),
        }(name='Boxes'),
        category?: string(name='Category'),
        contours?: [ 
          {
            x?: int32(name='X'),
            y?: int32(name='Y'),
          }
        ](name='Contours'),
        mask?: {
          counts?: string(name='Counts'),
          sizes?: [ int32 ](name='Sizes'),
        }(name='Mask'),
        score?: float(name='Score'),
      }
    ](name='Elements'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model CustomizeInstanceSegmentImageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CustomizeInstanceSegmentImageResponseBody(name='body'),
}

async function customizeInstanceSegmentImageWithOptions(request: CustomizeInstanceSegmentImageRequest, runtime: Util.RuntimeOptions): CustomizeInstanceSegmentImageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.imageUrl)) {
    body['ImageUrl'] = request.imageUrl;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CustomizeInstanceSegmentImage',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function customizeInstanceSegmentImage(request: CustomizeInstanceSegmentImageRequest): CustomizeInstanceSegmentImageResponse {
  var runtime = new Util.RuntimeOptions{};
  return customizeInstanceSegmentImageWithOptions(request, runtime);
}

async function customizeInstanceSegmentImageAdvance(request: CustomizeInstanceSegmentImageAdvanceRequest, runtime: Util.RuntimeOptions): CustomizeInstanceSegmentImageResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if(Util.isUnset(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if(Util.isUnset(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApi.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'viapi-regen',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = null;

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var customizeInstanceSegmentImageReq = new CustomizeInstanceSegmentImageRequest{};
  OpenApiUtil.convert(request, customizeInstanceSegmentImageReq);

  if(!Util.isUnset(request.imageUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.imageUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    customizeInstanceSegmentImageReq.imageUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var customizeInstanceSegmentImageResp = customizeInstanceSegmentImageWithOptions(customizeInstanceSegmentImageReq, runtime);
  return customizeInstanceSegmentImageResp;
}

model DebugServiceRequest {
  id?: long(name='Id'),
  param?: string(name='Param'),
}

model DebugServiceResponseBody = {
  data?: string(name='Data'),
  requestId?: string(name='RequestId'),
}

model DebugServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DebugServiceResponseBody(name='body'),
}

async function debugServiceWithOptions(request: DebugServiceRequest, runtime: Util.RuntimeOptions): DebugServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.param)) {
    body['Param'] = request.param;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DebugService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function debugService(request: DebugServiceRequest): DebugServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return debugServiceWithOptions(request, runtime);
}

model DeleteDataReflowDataRequest {
  id?: long(name='Id'),
  serviceId?: long(name='ServiceId'),
}

model DeleteDataReflowDataResponseBody = {
  data?: {
    gmtModified?: long(name='GmtModified'),
    id?: long(name='Id'),
    serviceId?: long(name='ServiceId'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteDataReflowDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDataReflowDataResponseBody(name='body'),
}

async function deleteDataReflowDataWithOptions(request: DeleteDataReflowDataRequest, runtime: Util.RuntimeOptions): DeleteDataReflowDataResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDataReflowData',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDataReflowData(request: DeleteDataReflowDataRequest): DeleteDataReflowDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDataReflowDataWithOptions(request, runtime);
}

model DeleteDatasetRequest {
  id?: long(name='Id'),
}

model DeleteDatasetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDatasetResponseBody(name='body'),
}

async function deleteDatasetWithOptions(request: DeleteDatasetRequest, runtime: Util.RuntimeOptions): DeleteDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDataset(request: DeleteDatasetRequest): DeleteDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDatasetWithOptions(request, runtime);
}

model DeleteLabelsetRequest {
  id?: long(name='Id'),
}

model DeleteLabelsetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelType?: string(name='LabelType'),
    name?: string(name='Name'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteLabelsetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteLabelsetResponseBody(name='body'),
}

async function deleteLabelsetWithOptions(request: DeleteLabelsetRequest, runtime: Util.RuntimeOptions): DeleteLabelsetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteLabelset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteLabelset(request: DeleteLabelsetRequest): DeleteLabelsetResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteLabelsetWithOptions(request, runtime);
}

model DeleteLabelsetDataRequest {
  id?: long(name='Id'),
  labelId?: long(name='LabelId'),
}

model DeleteLabelsetDataResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelType?: string(name='LabelType'),
    name?: string(name='Name'),
    status?: string(name='Status'),
    total?: long(name='Total'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteLabelsetDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteLabelsetDataResponseBody(name='body'),
}

async function deleteLabelsetDataWithOptions(request: DeleteLabelsetDataRequest, runtime: Util.RuntimeOptions): DeleteLabelsetDataResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.labelId)) {
    body['LabelId'] = request.labelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteLabelsetData',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteLabelsetData(request: DeleteLabelsetDataRequest): DeleteLabelsetDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteLabelsetDataWithOptions(request, runtime);
}

model DeleteServiceRequest {
  id?: long(name='Id'),
}

model DeleteServiceResponseBody = {
  data?: {
    id?: long(name='Id'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteServiceResponseBody(name='body'),
}

async function deleteServiceWithOptions(request: DeleteServiceRequest, runtime: Util.RuntimeOptions): DeleteServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteService(request: DeleteServiceRequest): DeleteServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteServiceWithOptions(request, runtime);
}

model DeleteTrainTaskRequest {
  id?: long(name='Id'),
}

model DeleteTrainTaskResponseBody = {
  data?: {
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTrainTaskResponseBody(name='body'),
}

async function deleteTrainTaskWithOptions(request: DeleteTrainTaskRequest, runtime: Util.RuntimeOptions): DeleteTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTrainTask(request: DeleteTrainTaskRequest): DeleteTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTrainTaskWithOptions(request, runtime);
}

model DeleteWorkspaceRequest {
  id?: long(name='Id'),
}

model DeleteWorkspaceResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    type?: string(name='Type'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteWorkspaceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteWorkspaceResponseBody(name='body'),
}

async function deleteWorkspaceWithOptions(request: DeleteWorkspaceRequest, runtime: Util.RuntimeOptions): DeleteWorkspaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteWorkspace',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteWorkspace(request: DeleteWorkspaceRequest): DeleteWorkspaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteWorkspaceWithOptions(request, runtime);
}

model DisableDataReflowRequest {
  serviceId?: long(name='ServiceId'),
}

model DisableDataReflowResponseBody = {
  data?: {
    enableDataReflowFlag?: boolean(name='EnableDataReflowFlag'),
    serviceId?: long(name='ServiceId'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DisableDataReflowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisableDataReflowResponseBody(name='body'),
}

async function disableDataReflowWithOptions(request: DisableDataReflowRequest, runtime: Util.RuntimeOptions): DisableDataReflowResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisableDataReflow',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableDataReflow(request: DisableDataReflowRequest): DisableDataReflowResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableDataReflowWithOptions(request, runtime);
}

model DownloadDatasetRequest {
  datasetId?: long(name='DatasetId'),
}

model DownloadDatasetResponseBody = {
  data?: {
    ossHttpUrl?: string(name='OssHttpUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DownloadDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DownloadDatasetResponseBody(name='body'),
}

async function downloadDatasetWithOptions(request: DownloadDatasetRequest, runtime: Util.RuntimeOptions): DownloadDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DownloadDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadDataset(request: DownloadDatasetRequest): DownloadDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadDatasetWithOptions(request, runtime);
}

model DownloadFileNameListRequest {
  datasetId?: long(name='DatasetId'),
  identity?: string(name='Identity'),
}

model DownloadFileNameListResponseBody = {
  data?: {
    ossHttpUrl?: string(name='OssHttpUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DownloadFileNameListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DownloadFileNameListResponseBody(name='body'),
}

async function downloadFileNameListWithOptions(request: DownloadFileNameListRequest, runtime: Util.RuntimeOptions): DownloadFileNameListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.identity)) {
    body['Identity'] = request.identity;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DownloadFileNameList',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadFileNameList(request: DownloadFileNameListRequest): DownloadFileNameListResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadFileNameListWithOptions(request, runtime);
}

model DownloadLabelFileRequest {
  labelId?: long(name='LabelId'),
}

model DownloadLabelFileResponseBody = {
  data?: {
    ossHttpUrl?: string(name='OssHttpUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model DownloadLabelFileResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DownloadLabelFileResponseBody(name='body'),
}

async function downloadLabelFileWithOptions(request: DownloadLabelFileRequest, runtime: Util.RuntimeOptions): DownloadLabelFileResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.labelId)) {
    body['LabelId'] = request.labelId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DownloadLabelFile',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadLabelFile(request: DownloadLabelFileRequest): DownloadLabelFileResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadLabelFileWithOptions(request, runtime);
}

model EnableDataReflowRequest {
  dataReflowOssPath?: string(name='DataReflowOssPath'),
  dataReflowRate?: long(name='DataReflowRate'),
  serviceId?: long(name='ServiceId'),
}

model EnableDataReflowResponseBody = {
  data?: {
    dataReflowOssPath?: string(name='DataReflowOssPath'),
    dataReflowRate?: long(name='DataReflowRate'),
    enableDataReflowFlag?: boolean(name='EnableDataReflowFlag'),
    serviceId?: long(name='ServiceId'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model EnableDataReflowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EnableDataReflowResponseBody(name='body'),
}

async function enableDataReflowWithOptions(request: EnableDataReflowRequest, runtime: Util.RuntimeOptions): EnableDataReflowResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.dataReflowOssPath)) {
    body['DataReflowOssPath'] = request.dataReflowOssPath;
  }
  if (!Util.isUnset(request.dataReflowRate)) {
    body['DataReflowRate'] = request.dataReflowRate;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'EnableDataReflow',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function enableDataReflow(request: EnableDataReflowRequest): EnableDataReflowResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableDataReflowWithOptions(request, runtime);
}

model ExportDataReflowDataListRequest {
  category?: string(name='Category'),
  endTime?: long(name='EndTime'),
  fileType?: string(name='FileType'),
  imageName?: string(name='ImageName'),
  serviceId?: long(name='ServiceId'),
  startTime?: long(name='StartTime'),
}

model ExportDataReflowDataListResponseBody = {
  data?: {
    ossHttpUrl?: string(name='OssHttpUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ExportDataReflowDataListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ExportDataReflowDataListResponseBody(name='body'),
}

async function exportDataReflowDataListWithOptions(request: ExportDataReflowDataListRequest, runtime: Util.RuntimeOptions): ExportDataReflowDataListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.category)) {
    body['Category'] = request.category;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.fileType)) {
    body['FileType'] = request.fileType;
  }
  if (!Util.isUnset(request.imageName)) {
    body['ImageName'] = request.imageName;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExportDataReflowDataList',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function exportDataReflowDataList(request: ExportDataReflowDataListRequest): ExportDataReflowDataListResponse {
  var runtime = new Util.RuntimeOptions{};
  return exportDataReflowDataListWithOptions(request, runtime);
}

model GetDatasetRequest {
  id?: long(name='Id'),
}

model GetDatasetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    ossUrl?: string(name='OssUrl'),
    ownerType?: string(name='OwnerType'),
    total?: long(name='Total'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDatasetResponseBody(name='body'),
}

async function getDatasetWithOptions(request: GetDatasetRequest, runtime: Util.RuntimeOptions): GetDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDataset(request: GetDatasetRequest): GetDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDatasetWithOptions(request, runtime);
}

model GetDiffCountLabelsetAndDatasetRequest {
  labelsetId?: long(name='LabelsetId'),
}

model GetDiffCountLabelsetAndDatasetResponseBody = {
  data?: {
    diffCount?: long(name='DiffCount'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetDiffCountLabelsetAndDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDiffCountLabelsetAndDatasetResponseBody(name='body'),
}

async function getDiffCountLabelsetAndDatasetWithOptions(request: GetDiffCountLabelsetAndDatasetRequest, runtime: Util.RuntimeOptions): GetDiffCountLabelsetAndDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.labelsetId)) {
    body['LabelsetId'] = request.labelsetId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetDiffCountLabelsetAndDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDiffCountLabelsetAndDataset(request: GetDiffCountLabelsetAndDatasetRequest): GetDiffCountLabelsetAndDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDiffCountLabelsetAndDatasetWithOptions(request, runtime);
}

model GetLabelDetailRequest {
  id?: long(name='Id'),
}

model GetLabelDetailResponseBody = {
  data?: {
    labelInfo?: string(name='LabelInfo'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetLabelDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetLabelDetailResponseBody(name='body'),
}

async function getLabelDetailWithOptions(request: GetLabelDetailRequest, runtime: Util.RuntimeOptions): GetLabelDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetLabelDetail',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getLabelDetail(request: GetLabelDetailRequest): GetLabelDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getLabelDetailWithOptions(request, runtime);
}

model GetLabelsetRequest {
  id?: long(name='Id'),
}

model GetLabelsetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelType?: string(name='LabelType'),
    name?: string(name='Name'),
    status?: string(name='Status'),
    subTaskPackageSize?: string(name='SubTaskPackageSize'),
    tagUserList?: string(name='TagUserList'),
    tags?: string(name='Tags'),
    total?: long(name='Total'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetLabelsetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetLabelsetResponseBody(name='body'),
}

async function getLabelsetWithOptions(request: GetLabelsetRequest, runtime: Util.RuntimeOptions): GetLabelsetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetLabelset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getLabelset(request: GetLabelsetRequest): GetLabelsetResponse {
  var runtime = new Util.RuntimeOptions{};
  return getLabelsetWithOptions(request, runtime);
}

model GetServiceRequest {
  id?: long(name='Id'),
}

model GetServiceResponseBody = {
  data?: {
    dataReflowInfo?: {
      dataReflowCount?: long(name='DataReflowCount'),
      dataReflowOssPath?: string(name='DataReflowOssPath'),
      dataReflowRate?: long(name='DataReflowRate'),
      enableDataReflowFlag?: boolean(name='EnableDataReflowFlag'),
    }(name='DataReflowInfo'),
    errorcodes?: string(name='Errorcodes'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    inputExample?: string(name='InputExample'),
    inputParams?: string(name='InputParams'),
    outputExample?: string(name='OutputExample'),
    outputParams?: string(name='OutputParams'),
    serviceDescription?: string(name='ServiceDescription'),
    serviceId?: string(name='ServiceId'),
    serviceName?: string(name='ServiceName'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceResponseBody(name='body'),
}

async function getServiceWithOptions(request: GetServiceRequest, runtime: Util.RuntimeOptions): GetServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getService(request: GetServiceRequest): GetServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceWithOptions(request, runtime);
}

model GetServiceInvokeRequest {
  callerParentIdList?: [ string ](name='CallerParentIdList'),
  endTime?: long(name='EndTime'),
  id?: long(name='Id'),
  startTime?: long(name='StartTime'),
}

model GetServiceInvokeShrinkRequest {
  callerParentIdListShrink?: string(name='CallerParentIdList'),
  endTime?: long(name='EndTime'),
  id?: long(name='Id'),
  startTime?: long(name='StartTime'),
}

model GetServiceInvokeResponseBody = {
  data?: {
    userInvoke?: map[string]any(name='UserInvoke'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetServiceInvokeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceInvokeResponseBody(name='body'),
}

async function getServiceInvokeWithOptions(tmpReq: GetServiceInvokeRequest, runtime: Util.RuntimeOptions): GetServiceInvokeResponse {
  Util.validateModel(tmpReq);
  var request = new GetServiceInvokeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.callerParentIdList)) {
    request.callerParentIdListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.callerParentIdList, 'CallerParentIdList', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.callerParentIdListShrink)) {
    body['CallerParentIdList'] = request.callerParentIdListShrink;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceInvoke',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServiceInvoke(request: GetServiceInvokeRequest): GetServiceInvokeResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceInvokeWithOptions(request, runtime);
}

model GetServiceQpsRequest {
  callerParentIdList?: [ string ](name='CallerParentIdList'),
  endTime?: long(name='EndTime'),
  id?: long(name='Id'),
  startTime?: long(name='StartTime'),
}

model GetServiceQpsShrinkRequest {
  callerParentIdListShrink?: string(name='CallerParentIdList'),
  endTime?: long(name='EndTime'),
  id?: long(name='Id'),
  startTime?: long(name='StartTime'),
}

model GetServiceQpsResponseBody = {
  data?: {
    userQps?: map[string]any(name='UserQps'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetServiceQpsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceQpsResponseBody(name='body'),
}

async function getServiceQpsWithOptions(tmpReq: GetServiceQpsRequest, runtime: Util.RuntimeOptions): GetServiceQpsResponse {
  Util.validateModel(tmpReq);
  var request = new GetServiceQpsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.callerParentIdList)) {
    request.callerParentIdListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.callerParentIdList, 'CallerParentIdList', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.callerParentIdListShrink)) {
    body['CallerParentIdList'] = request.callerParentIdListShrink;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceQps',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServiceQps(request: GetServiceQpsRequest): GetServiceQpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceQpsWithOptions(request, runtime);
}

model GetTrainModelRequest {
  id?: long(name='Id'),
}

model GetTrainModelResponseBody = {
  data?: {
    simpleEvaluate?: long(name='SimpleEvaluate'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetTrainModelResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTrainModelResponseBody(name='body'),
}

async function getTrainModelWithOptions(request: GetTrainModelRequest, runtime: Util.RuntimeOptions): GetTrainModelResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTrainModel',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrainModel(request: GetTrainModelRequest): GetTrainModelResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTrainModelWithOptions(request, runtime);
}

model GetTrainTaskRequest {
  id?: long(name='Id'),
}

model GetTrainTaskResponseBody = {
  data?: {
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    failureReason?: string(name='FailureReason'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
    trainUseTime?: long(name='TrainUseTime'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTrainTaskResponseBody(name='body'),
}

async function getTrainTaskWithOptions(request: GetTrainTaskRequest, runtime: Util.RuntimeOptions): GetTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrainTask(request: GetTrainTaskRequest): GetTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTrainTaskWithOptions(request, runtime);
}

model GetTrainTaskEstimatedTimeRequest {
  id?: long(name='Id'),
}

model GetTrainTaskEstimatedTimeResponseBody = {
  data?: {
    estimatedTime?: string(name='EstimatedTime'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetTrainTaskEstimatedTimeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTrainTaskEstimatedTimeResponseBody(name='body'),
}

async function getTrainTaskEstimatedTimeWithOptions(request: GetTrainTaskEstimatedTimeRequest, runtime: Util.RuntimeOptions): GetTrainTaskEstimatedTimeResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTrainTaskEstimatedTime',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrainTaskEstimatedTime(request: GetTrainTaskEstimatedTimeRequest): GetTrainTaskEstimatedTimeResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTrainTaskEstimatedTimeWithOptions(request, runtime);
}

model GetUploadPolicyRequest {
  fileName?: string(name='FileName'),
  id?: long(name='Id'),
  type?: string(name='Type'),
}

model GetUploadPolicyResponseBody = {
  data?: {
    accessId?: string(name='AccessId'),
    bucketName?: string(name='BucketName'),
    endpoint?: string(name='Endpoint'),
    fileName?: string(name='FileName'),
    objectKey?: string(name='ObjectKey'),
    originalFilename?: string(name='OriginalFilename'),
    policy?: string(name='Policy'),
    signature?: string(name='Signature'),
    signedHttpUrl?: string(name='SignedHttpUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetUploadPolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUploadPolicyResponseBody(name='body'),
}

async function getUploadPolicyWithOptions(request: GetUploadPolicyRequest, runtime: Util.RuntimeOptions): GetUploadPolicyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fileName)) {
    body['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUploadPolicy',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUploadPolicy(request: GetUploadPolicyRequest): GetUploadPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUploadPolicyWithOptions(request, runtime);
}

model GetUserInfoResponseBody = {
  data?: {
    parentUid?: string(name='ParentUid'),
    userType?: string(name='UserType'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetUserInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserInfoResponseBody(name='body'),
}

async function getUserInfoWithOptions(runtime: Util.RuntimeOptions): GetUserInfoResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetUserInfo',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUserInfo(): GetUserInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserInfoWithOptions(runtime);
}

model GetWorkspaceRequest {
  id?: long(name='Id'),
}

model GetWorkspaceResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    type?: string(name='Type'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model GetWorkspaceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetWorkspaceResponseBody(name='body'),
}

async function getWorkspaceWithOptions(request: GetWorkspaceRequest, runtime: Util.RuntimeOptions): GetWorkspaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetWorkspace',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getWorkspace(request: GetWorkspaceRequest): GetWorkspaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getWorkspaceWithOptions(request, runtime);
}

model ListDataReflowDatasRequest {
  category?: string(name='Category'),
  currentPage?: long(name='CurrentPage'),
  endTime?: long(name='EndTime'),
  imageName?: string(name='ImageName'),
  pageSize?: long(name='PageSize'),
  serviceId?: long(name='ServiceId'),
  startTime?: long(name='StartTime'),
}

model ListDataReflowDatasResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListDataReflowDatasResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDataReflowDatasResponseBody(name='body'),
}

async function listDataReflowDatasWithOptions(request: ListDataReflowDatasRequest, runtime: Util.RuntimeOptions): ListDataReflowDatasResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.category)) {
    body['Category'] = request.category;
  }
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.imageName)) {
    body['ImageName'] = request.imageName;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListDataReflowDatas',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDataReflowDatas(request: ListDataReflowDatasRequest): ListDataReflowDatasResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDataReflowDatasWithOptions(request, runtime);
}

model ListDatasetDatasRequest {
  currentPage?: long(name='CurrentPage'),
  datasetId?: long(name='DatasetId'),
  identity?: string(name='Identity'),
  pageSize?: long(name='PageSize'),
}

model ListDatasetDatasResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListDatasetDatasResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDatasetDatasResponseBody(name='body'),
}

async function listDatasetDatasWithOptions(request: ListDatasetDatasRequest, runtime: Util.RuntimeOptions): ListDatasetDatasResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.identity)) {
    body['Identity'] = request.identity;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListDatasetDatas',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDatasetDatas(request: ListDatasetDatasRequest): ListDatasetDatasResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDatasetDatasWithOptions(request, runtime);
}

model ListDatasetsRequest {
  currentPage?: long(name='CurrentPage'),
  pageSize?: long(name='PageSize'),
  workspaceId?: long(name='WorkspaceId'),
}

model ListDatasetsResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListDatasetsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDatasetsResponseBody(name='body'),
}

async function listDatasetsWithOptions(request: ListDatasetsRequest, runtime: Util.RuntimeOptions): ListDatasetsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListDatasets',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDatasets(request: ListDatasetsRequest): ListDatasetsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDatasetsWithOptions(request, runtime);
}

model ListLabelsetDatasRequest {
  currentPage?: long(name='CurrentPage'),
  isAbandon?: boolean(name='IsAbandon'),
  labelId?: long(name='LabelId'),
  name?: string(name='Name'),
  operation?: string(name='Operation'),
  pageSize?: long(name='PageSize'),
  value?: string(name='Value'),
}

model ListLabelsetDatasResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListLabelsetDatasResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLabelsetDatasResponseBody(name='body'),
}

async function listLabelsetDatasWithOptions(request: ListLabelsetDatasRequest, runtime: Util.RuntimeOptions): ListLabelsetDatasResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.isAbandon)) {
    body['IsAbandon'] = request.isAbandon;
  }
  if (!Util.isUnset(request.labelId)) {
    body['LabelId'] = request.labelId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.operation)) {
    body['Operation'] = request.operation;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.value)) {
    body['Value'] = request.value;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListLabelsetDatas',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLabelsetDatas(request: ListLabelsetDatasRequest): ListLabelsetDatasResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLabelsetDatasWithOptions(request, runtime);
}

model ListLabelsetsRequest {
  currentPage?: long(name='CurrentPage'),
  datasetId?: long(name='DatasetId'),
  pageSize?: long(name='PageSize'),
  status?: string(name='Status'),
}

model ListLabelsetsResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListLabelsetsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLabelsetsResponseBody(name='body'),
}

async function listLabelsetsWithOptions(request: ListLabelsetsRequest, runtime: Util.RuntimeOptions): ListLabelsetsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListLabelsets',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLabelsets(request: ListLabelsetsRequest): ListLabelsetsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLabelsetsWithOptions(request, runtime);
}

model ListServicesRequest {
  currentPage?: long(name='CurrentPage'),
  id?: long(name='Id'),
  name?: long(name='Name'),
  pageSize?: long(name='PageSize'),
  workspaceId?: long(name='WorkspaceId'),
}

model ListServicesResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListServicesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListServicesResponseBody(name='body'),
}

async function listServicesWithOptions(request: ListServicesRequest, runtime: Util.RuntimeOptions): ListServicesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListServices',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listServices(request: ListServicesRequest): ListServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listServicesWithOptions(request, runtime);
}

model ListTrainTasksRequest {
  currentPage?: long(name='CurrentPage'),
  pageSize?: long(name='PageSize'),
  status?: string(name='Status'),
  workspaceId?: long(name='WorkspaceId'),
}

model ListTrainTasksResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [  map[string]any ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListTrainTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTrainTasksResponseBody(name='body'),
}

async function listTrainTasksWithOptions(request: ListTrainTasksRequest, runtime: Util.RuntimeOptions): ListTrainTasksResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainTasks',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTrainTasks(request: ListTrainTasksRequest): ListTrainTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTrainTasksWithOptions(request, runtime);
}

model ListWorkspacesRequest {
  currentPage?: long(name='CurrentPage'),
  name?: string(name='Name'),
  pageSize?: long(name='PageSize'),
}

model ListWorkspacesResponseBody = {
  data?: {
    currentPage?: long(name='CurrentPage'),
    elements?: [ 
      {
        description?: string(name='Description'),
        gmtCreate?: long(name='GmtCreate'),
        id?: long(name='Id'),
        name?: string(name='Name'),
        type?: string(name='Type'),
      }
    ](name='Elements'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
    totalPage?: long(name='TotalPage'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model ListWorkspacesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListWorkspacesResponseBody(name='body'),
}

async function listWorkspacesWithOptions(request: ListWorkspacesRequest, runtime: Util.RuntimeOptions): ListWorkspacesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListWorkspaces',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listWorkspaces(request: ListWorkspacesRequest): ListWorkspacesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listWorkspacesWithOptions(request, runtime);
}

model SetDatasetUserOssPathRequest {
  datasetId?: long(name='DatasetId'),
  userOssUrl?: string(name='UserOssUrl'),
}

model SetDatasetUserOssPathResponseBody = {
  data?: {
    id?: long(name='Id'),
    ossUrl?: string(name='OssUrl'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model SetDatasetUserOssPathResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SetDatasetUserOssPathResponseBody(name='body'),
}

async function setDatasetUserOssPathWithOptions(request: SetDatasetUserOssPathRequest, runtime: Util.RuntimeOptions): SetDatasetUserOssPathResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.datasetId)) {
    body['DatasetId'] = request.datasetId;
  }
  if (!Util.isUnset(request.userOssUrl)) {
    body['UserOssUrl'] = request.userOssUrl;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SetDatasetUserOssPath',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function setDatasetUserOssPath(request: SetDatasetUserOssPathRequest): SetDatasetUserOssPathResponse {
  var runtime = new Util.RuntimeOptions{};
  return setDatasetUserOssPathWithOptions(request, runtime);
}

model StartServiceRequest {
  id?: long(name='Id'),
}

model StartServiceResponseBody = {
  data?: {
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    serviceDescription?: string(name='ServiceDescription'),
    serviceName?: string(name='ServiceName'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model StartServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartServiceResponseBody(name='body'),
}

async function startServiceWithOptions(request: StartServiceRequest, runtime: Util.RuntimeOptions): StartServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startService(request: StartServiceRequest): StartServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startServiceWithOptions(request, runtime);
}

model StartTrainTaskRequest {
  forceStartFlag?: boolean(name='ForceStartFlag'),
  id?: long(name='Id'),
  relyOnTaskId?: long(name='RelyOnTaskId'),
}

model StartTrainTaskResponseBody = {
  data?: {
    checkResult?: map[string]any(name='CheckResult'),
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model StartTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartTrainTaskResponseBody(name='body'),
}

async function startTrainTaskWithOptions(request: StartTrainTaskRequest, runtime: Util.RuntimeOptions): StartTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.forceStartFlag)) {
    body['ForceStartFlag'] = request.forceStartFlag;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.relyOnTaskId)) {
    body['RelyOnTaskId'] = request.relyOnTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startTrainTask(request: StartTrainTaskRequest): StartTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return startTrainTaskWithOptions(request, runtime);
}

model StopServiceRequest {
  id?: long(name='Id'),
}

model StopServiceResponseBody = {
  data?: {
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    serviceDescription?: string(name='ServiceDescription'),
    serviceName?: string(name='ServiceName'),
    status?: string(name='Status'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model StopServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopServiceResponseBody(name='body'),
}

async function stopServiceWithOptions(request: StopServiceRequest, runtime: Util.RuntimeOptions): StopServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StopService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopService(request: StopServiceRequest): StopServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopServiceWithOptions(request, runtime);
}

model StopTrainTaskRequest {
  id?: long(name='Id'),
}

model StopTrainTaskResponseBody = {
  data?: {
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model StopTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopTrainTaskResponseBody(name='body'),
}

async function stopTrainTaskWithOptions(request: StopTrainTaskRequest, runtime: Util.RuntimeOptions): StopTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StopTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopTrainTask(request: StopTrainTaskRequest): StopTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopTrainTaskWithOptions(request, runtime);
}

model UpdateDatasetRequest {
  description?: string(name='Description'),
  id?: long(name='Id'),
  name?: string(name='Name'),
}

model UpdateDatasetResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateDatasetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateDatasetResponseBody(name='body'),
}

async function updateDatasetWithOptions(request: UpdateDatasetRequest, runtime: Util.RuntimeOptions): UpdateDatasetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDataset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateDataset(request: UpdateDatasetRequest): UpdateDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateDatasetWithOptions(request, runtime);
}

model UpdateLabelsetRequest {
  description?: string(name='Description'),
  id?: long(name='Id'),
  name?: string(name='Name'),
  objectKey?: string(name='ObjectKey'),
  tagUserList?: string(name='TagUserList'),
  userOssUrl?: string(name='UserOssUrl'),
}

model UpdateLabelsetResponseBody = {
  data?: {
    description?: long(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: long(name='Name'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateLabelsetResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateLabelsetResponseBody(name='body'),
}

async function updateLabelsetWithOptions(request: UpdateLabelsetRequest, runtime: Util.RuntimeOptions): UpdateLabelsetResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.objectKey)) {
    body['ObjectKey'] = request.objectKey;
  }
  if (!Util.isUnset(request.tagUserList)) {
    body['TagUserList'] = request.tagUserList;
  }
  if (!Util.isUnset(request.userOssUrl)) {
    body['UserOssUrl'] = request.userOssUrl;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateLabelset',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateLabelset(request: UpdateLabelsetRequest): UpdateLabelsetResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateLabelsetWithOptions(request, runtime);
}

model UpdateServiceRequest {
  authorizationType?: string(name='AuthorizationType'),
  authorizedAccount?: string(name='AuthorizedAccount'),
  description?: string(name='Description'),
  id?: long(name='Id'),
  name?: string(name='Name'),
}

model UpdateServiceResponseBody = {
  data?: {
    authorizationType?: string(name='AuthorizationType'),
    authorizedAccount?: string(name='AuthorizedAccount'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    serviceDescription?: string(name='ServiceDescription'),
    serviceName?: string(name='ServiceName'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateServiceResponseBody(name='body'),
}

async function updateServiceWithOptions(request: UpdateServiceRequest, runtime: Util.RuntimeOptions): UpdateServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.authorizationType)) {
    body['AuthorizationType'] = request.authorizationType;
  }
  if (!Util.isUnset(request.authorizedAccount)) {
    body['AuthorizedAccount'] = request.authorizedAccount;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateService',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateService(request: UpdateServiceRequest): UpdateServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateServiceWithOptions(request, runtime);
}

model UpdateTrainTaskRequest {
  advancedParameters?: string(name='AdvancedParameters'),
  datasetIds?: string(name='DatasetIds'),
  description?: string(name='Description'),
  id?: long(name='Id'),
  labelIds?: string(name='LabelIds'),
  name?: string(name='Name'),
  preTrainTaskFlag?: boolean(name='PreTrainTaskFlag'),
  preTrainTaskId?: long(name='PreTrainTaskId'),
  trainMode?: string(name='TrainMode'),
}

model UpdateTrainTaskResponseBody = {
  data?: {
    advancedParameters?: string(name='AdvancedParameters'),
    datasetId?: long(name='DatasetId'),
    datasetName?: string(name='DatasetName'),
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    labelId?: long(name='LabelId'),
    labelName?: string(name='LabelName'),
    modelEffect?: string(name='ModelEffect'),
    modelId?: long(name='ModelId'),
    taskName?: string(name='TaskName'),
    trainMode?: string(name='TrainMode'),
    trainStatus?: string(name='TrainStatus'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateTrainTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateTrainTaskResponseBody(name='body'),
}

async function updateTrainTaskWithOptions(request: UpdateTrainTaskRequest, runtime: Util.RuntimeOptions): UpdateTrainTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.advancedParameters)) {
    body['AdvancedParameters'] = request.advancedParameters;
  }
  if (!Util.isUnset(request.datasetIds)) {
    body['DatasetIds'] = request.datasetIds;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.labelIds)) {
    body['LabelIds'] = request.labelIds;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.preTrainTaskFlag)) {
    body['PreTrainTaskFlag'] = request.preTrainTaskFlag;
  }
  if (!Util.isUnset(request.preTrainTaskId)) {
    body['PreTrainTaskId'] = request.preTrainTaskId;
  }
  if (!Util.isUnset(request.trainMode)) {
    body['TrainMode'] = request.trainMode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTrainTask',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTrainTask(request: UpdateTrainTaskRequest): UpdateTrainTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTrainTaskWithOptions(request, runtime);
}

model UpdateWorkspaceRequest {
  description?: string(name='Description'),
  id?: long(name='Id'),
  name?: string(name='Name'),
}

model UpdateWorkspaceResponseBody = {
  data?: {
    description?: string(name='Description'),
    gmtCreate?: long(name='GmtCreate'),
    id?: long(name='Id'),
    name?: string(name='Name'),
    type?: string(name='Type'),
  }(name='Data'),
  requestId?: string(name='RequestId'),
}

model UpdateWorkspaceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateWorkspaceResponseBody(name='body'),
}

async function updateWorkspaceWithOptions(request: UpdateWorkspaceRequest, runtime: Util.RuntimeOptions): UpdateWorkspaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.id)) {
    body['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateWorkspace',
    version = '2021-11-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateWorkspace(request: UpdateWorkspaceRequest): UpdateWorkspaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateWorkspaceWithOptions(request, runtime);
}

